    <include file="Public/head"/>
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css" />
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<script src="http://img1.isou365.cn/paimai/yunying/js/city.js" type="text/javascript"></script>
<style>
    .xuanzhe ul li .menDao1{width:300px;}
    .xuanzhe ul li .menDao1 a{display:block;background:#cecece;color:#303030;float:left;width:36px; text-align:center;height:20px; line-height:20px; cursor:pointer;}
    .xuanzhe ul li .menDao1 .menHover{ background:#20ab4f;color:#fff;}
    .xuanzhe .lift-truck{width:280px;padding:10px;display:block; background:#e1e1e1;border-radius:5px;margin-left:60px;margin-top:-10px;}
    .xuanzhe .lift-truck #taker_phone,.xuanzhe .lift-truck #taker_sex,.xuanzhe .lift-truck #taker_card,.xuanzhe .lift-truck #take_car_num{width:280px; display:block;height:30px; line-height:30px; text-align:left;}
    .xuanzhe .lift-truck span em{float:left; display:block;width:60px; text-align:right;}
</style>
<include file="Public/common_header"/>
<div class="mian">
    <include file="Public/sidebar" menu="pmgl.cszy"/>
    <div class="mianR">
        <h3 class="yonghu"> 车商争议详情</h3>
        <div class="chezhu-xinxi">
            <div class="xinxi-conter xinxi-conter1" style="background: none;border: none">
                <h4 class="order_no">拍卖单号：<b>{$detail.order_no}</b></h4>
            </div>
            <br/>
            <div class="xinxi-conter xinxi-conter1">
                <h4>车商信息</h4>
                <ul>
                    <li class="clearfix">
                        <em>车商姓名</em><em class="name-text">{$detail.contact_person}</em>
                        <em>车商电话</em><em class="dian-hua">{$detail.contact_mobile}</em>
                    </li>
                </ul>
            </div>
            <br/>
            <div class="xinxi-conter xinxi-conter1">
                <h4>评估师信息</h4>
                <ul>
                    <li class="clearfix">
                        <em>评估师姓名</em><em class="name-text">{$detail.checker_name}</em>
                        <em>评估师电话</em><em class="dian-hua">{$detail.checker_mobile}</em>
                    </li>
                </ul>
            </div>
            <br/>
            <div class="xinxi-conter xinxi-conter1">
                <h4>车辆信息</h4>
                <ul>
                    <li class="clearfix">
                        <em>车型</em><em class="name-text">{$detail.model}</em>
                        <em>排放标准</em><em class="dian-hua">{$detail.emission}</em>
                    </li>

                    <li class="clearfix">
                        <em>初登日期</em><em class="name-text">{$detail.first_reg_date}</em>
                        <em>颜色</em><em class="dian-hua">{$detail.car_color}</em>
                    </li>
                    <li class="clearfix">
                        <em>表显里程</em><em class="name-text">{$detail.pointer_mileage}万公里</em>
                        <em>车况级别</em><em class="name-text">{$detail.composite_state}{$detail.accident_level}</em>
                    </li>
                    <li class="clearfix">
                        <em>车辆注册地</em><em class="name-text">{$detail.reg_city}</em>
                        <em>车架号</em><em class="name-text">{$detail.vin}</em>
                    </li>                    
                    <li class="clearfix">
                        <em>过户限制</em><em class="name-text">{$transfer_type[$car_detail['transfer_limit']]}</em>
                        <em>车牌号</em><em class="name-text">{$detail.plate_prefix}{$detail.plate_suffix}</em>
                    </li>
                    <li class="clearfix">
                        <em>渠道来源</em><em class="name-text">
                            <if condition="$car_detail.comefrom neq ''">
                            <?php if(empty($car_detail['comefrom_url'])):?>
                              <?php echo $show_from[$car_detail['comefrom']];?>
                            <?php else: ?>
                              <a href="{$car_detail.comefrom_url}" target="_blank" rel="noreferrer"><?php echo $show_from[$car_detail['comefrom']];?></a>
                            <?php endif;?>
                            <else/>
                              未知
                            </if>
                        </em>
                        <em>所在地</em><em class="name-text">{$detail.location_area_name}</em>
                    </li>
                </ul>
            </div>
            <br/>
            <div class="xinxi-conter xinxi-conter1">
                <h4>复检信息</h4>
                <ul>
                    <li class="clearfix">
                        <em>车况复检员</em><em class="name-text">{$detail.condition_checker_name}</em>
                        <em>复检时间</em><em class="name-text">
                        <?php if(!empty($detail['recheck_time'])){ ?>
                        {$detail.recheck_time|strtotime|date='Y-m-d H:i',###}
                        <?php } ?>
                        </em>
                    </li>
                    <li class="clearfix">
                        <em>复检备注</em><em class="name-text">{$detail.recheck_remark}</em>
                    </li>
                </ul>
            </div>
            <br/>
            <div class="xinxi-conter xinxi-conter1">
                <h4>
                    付款信息（{$detail.pay_status_name}<if condition="$detail.pay_status_code eq 21"> 100%）<elseif condition="$detail.pay_status_code eq 22"/> 50%）<elseif condition="$detail.pay_status_code eq 23" />0%）<else />）</if>
                </h4>
                <ul>
                    <li class="clearfix">
                        <em>付款人</em>
                        <em class="name-text">
                            <if condition="$detail.emp_id gt 0">
                                {$detail.pay_man}
                                <else />
                                --
                            </if>
                        </em>
                        <em>付款时间</em>
                        <em class="name-text">
                            <if condition="$detail.pay_status eq 1">
                            {$detail.pay_time}
                            <else />
                            --
                            </if>
                        </em>
                    </li>
                </ul>
            </div>
            <br/>
            <?php if ($detail['issue_type'] != $issue_types['violate']['code']): ?>
                <div class="xinxi-conter xinxi-conter1">
                    <h4>验车信息</h4>
                    <ul>
                        <li class="clearfix">
                            <em>验车时间</em><em class="name-text">
                            <?php if(!empty($detail['check_done_time']) && $detail['check_done_time'] > 0){ ?>
                            {$detail.check_done_time|strtotime|date='Y-m-d H:i',###}
                            <?php } ?>                        
                            </em>
                        </li>
                        <li class="clearfix">
                            <em>验车备注</em><em class="name-text" style="width:760px;">{$detail.dealer_check_remark}</em>
                        </li>
                    </ul>
                </div>
                <br/>
            <?php endif ?>
            <div class="xinxi-conter xinxi-conter1">
                <h4>争议信息</h4>
                <ul>
                    <li class="clearfix">
                        <em>争议类型</em><em class="name-text">{$detail.issue_type_name}</em>
                    </li>
                    <li class="clearfix">
                        <em>争议原因</em><em class="name-text" style="width:760px;">{$detail.issue_remark}</em>
                    </li>
                </ul>
            </div>
            
        </div>
        
        <if condition="$detail['status'] gt 0 ">
            <h3 class="yonghu">选择仲裁结果</h3>
            <div class="yuyue">
                <ul>
                    <li class="yuCurrent">协商补偿</li>
                    <li>我方违约</li>
                    <li>车商违约</li>
                </ul>
            </div>
            <div class="listBox">
            <input type="hidden" id="issue_id" name="issue_id"  value="{$detail['issue_id']}"/>
            <div class="yuList">
                <div class="xuanzhe">
                    <ul>
                        <li class="clearfix">
                            <span>补偿金额</span>
                            <input type="text" name="company_subsidies" id="company_subsidies" class="company_subsidies" value="" maxlength="10"/><em>元</em><em style="color:red;">&nbsp;*</em>
                        </li>
                        <?php 
                            if (isset($detail['level']) && $detail['level'] == 2 && $detail['issue_type']==1) { // /*商家级别(会员类型)*/ ('1' => '普通', '2' => '金牌'),争议类型1车况不符
                        ?>
                            <li class="clearfix">
                        <?php } else { ?>
                            <li class="clearfix" style="display: none;">
                        <?php } ?>
                            <span>过户要求</span>
                            <span class="menDao">
                                <a href="javascript:void(0);" onclick="ghyq(0)" class="menHover">公司过户</a>
                                <a href="javascript:void(0);" onclick="ghyq(1)" >车商自过</a>
                            </span>
                            <input type="hidden" id="service_method" name="service_method"  value="0"/>
                        </li>
                        <li id="input_ticheren_list" class="clearfix" style="display: none;">
                            <span>提车人</span>
                            <div class="store">
                                <div class="detailed" style="display: block;">
                                   <select id="take_car_man" name="take_car_man" style="width:150px;">
                                    <option value="0" cardid="" sexid="" takenum="" mobile="">请选择提车人</option>
                                    <?php foreach($take_men as $k=>$man):?>
                                    <option cardid="{$man.idcard}" sexid="{$man.sex}"  takenum="{$man.take_num}" mobile="{$man.mobile}" value="{$man.man_id}">{$man.real_name}</option>
                                    <?php endforeach;?>
                                   </select>
                                </div>
                            </div>
                        </li>
                        <li id="input_ticheren_info" class="clearfix lift-truck" style="display: none;">
                            <span style='' id = "taker_phone"><em>手机：</em></span><br/>
                            <span style='' id = "taker_card"><em>身份证：</em><span></span></span><br/>
                            <span style='' id = "take_car_num"><em>提车数量：</em></span>
                        </li>
                        <li class="clearfix remarks">
                            <span>备注</span><textarea name="reserve_remark"></textarea>
                        </li>
                        <li><p style="color:#F00;">说明：我方评估师检测失误或其他原因造成车况和报告不符，协商后车商愿意接受补偿继续交易</p></li>
                    </ul>
                </div>

                <div class="yongBtn">
                    <input type="hidden" name="re_auction_type" value="{$re_auction_type}" />
                    <input type="hidden" name="first_money" value="{$first_money}" />
                    <input type="submit" value="确定" class="queding consultpay"/>
                    <input class="quxiao" type="submit" value="返回" onclick="history.back();">
                </div>
            </div>
            <div class="yuList" style="display:none;">
                    <div class="xuanzhe">
                        <ul>
                            <li class="clearfix ">
                                <span>补偿金额</span>
                                <input type="text" name="compensate_price" id="compensate_price" value="" class="company_subsidies" maxlength="10"/><em>元</em>
                                <em style="color:red;">&nbsp;*</em>
                               <!--  <div style="color:#cc0000;position:absolute;right:-170px;top:0;">（违约金金额不能超过2000元）</div>  -->
                            </li>
                            <li class="clearfix remarks">
                                <span>备注</span><textarea name="compensate_remark"></textarea><em style="color:red;">&nbsp;*</em>
                            </li>
                            <li><p style="color:#F00;">说明：我方评估师检测失误或其他原因造成车况和报告不符，协商后车商不愿接受或者我方赔付成本太高。</p></li>
                        </ul>
                    </div>
                    <div class="yongBtn">
                        <input type="submit" value="确定" class="queding ourviolate"/>
                        <input class="quxiao" type="submit" value="返回" onclick="history.back();">
                    </div>
            </div>
            <div class="yuList" style="display:none;">
                    <div class="xuanzhe">
                        <ul>
                            <li class="clearfix ">
                                <span>扣除金额</span>
                                <input type="text" name="deduct_price" id="deduct_price" value="" class="company_subsidies" maxlength="10"/><em>元</em><em style="color:red;">&nbsp;*</em>
                                <div style="color:#cc0000;position:absolute;right:-170px;top:0;">（违约金金额不能超过2000元）</div> 
                            </li>
                            <li class="clearfix remarks">
                                <span>违约原因</span><textarea name="violate_remark"></textarea><em style="color:red;">&nbsp;*</em>
                            </li>
                            <li><p style="color:#F00">说明：由于车商原因引起的违约，需要输入违约金。</p></li>
                        </ul>
                    </div>
                    <div class="yongBtn">
                        <input type="submit" value="确定" class="queding consultation"/>
                        <input class="quxiao" type="submit" value="返回" onclick="history.back();">
                    </div>
            </div>
        </div>
        </if>

    </div>
    <div class="clear"></div>
</div>
<script>
    $(function(){
        $(".xuanzhe .company_subsidies").keyup(function(){
            $(this).val($(this).val().replace(/[^\d.]/g, ""));
        })
    })

    function ghyq(type_val) {
        $('#service_method').val(type_val);
        if (type_val == 1) {
            $('#input_ticheren_list,#input_ticheren_info').show();
        } else {
            $('#input_ticheren_list,#input_ticheren_info').hide();
        }
    }
    $(function () {
        $("#take_car_man").select2();
    });
    $("#take_car_man").change(function(){
        var idcard = $(this).find("option:selected").attr("cardid");
        var take_num = $(this).find("option:selected").attr("takenum");
        var mobile = $(this).find("option:selected").attr("mobile");
        $("#taker_phone").html("<em>手机：</em>"+mobile);
        $("#taker_card").html("<em>身份证：</em>"+idcard);
        $("#take_car_num").html("<em>提车数量：</em>"+take_num);
    })

    // --协商补偿金额验证
    function validate_consult_price(price_now) {
        if (price_now == '') {
            shibai_alert('金额不能为空!');
            return false;
        }
        if (!/(^[0-9]\d*$)/.test(price_now)) {
            shibai_alert('金额格式不正确!');
            return false;
        }
        return true;
    }

    $('.consultpay').click(function () {
        var order_id = '{$detail.order_id}';
        var car_id = '{$detail.car_id}';
        var dealer_id = '{$detail.dealer_id}';
        var issue_id = '{$detail.issue_id}';
        if (order_id == '') {
            shibai_alert('缺少必要参数，请联系管理员');
            return;
        }
        var owner_id = '{$detail.owner_id}';
        // if (owner_id == '') {
        //     shibai_alert('缺少必要参数，请联系管理员');
        //     return;
        // }
        var payprice = $("#company_subsidies").val();
        var isValidPrice = validate_consult_price(payprice);
        if (isValidPrice == false) return;
        var take_car_man = $("#take_car_man").val();
        var service_method = $('#service_method').val();
        var reserve_remark = $.trim($('textarea[name=reserve_remark]').val());
        if (reserve_remark == '') {
            shibai_alert('请填写备注信息');
            return;
        };
        do_consult_pay();
        function do_consult_pay() {
            var param = {
                'issue_id': issue_id,
                'order_id': order_id,
                'car_id':car_id,
                'dealer_id':dealer_id,
                'owner_id': owner_id,
                'payprice': payprice,
                'take_car_man': take_car_man,
                'service_method': service_method,
                'pay_remark': reserve_remark
            };
            $.post('/IssueDealer/doConsultPay', param, function (data) {
                if (data.code == '200') {
                    btn_alert(data.msg, 2000, function () {
                        window.location.href = document.referrer;
                    });
                } else {
                    shibai_alert(data.msg);
                    return false;
                }
            }, 'json')
        }
    });
     // --车商违约扣除金额验证
    function validate_deduct_price(price_now) {
        if (price_now == '') {
            shibai_alert('金额不能为空!');
            return false;
        }
        if (!/(^[0-9]\d*$)/.test(price_now)) {
            shibai_alert('金额格式不正确!');
            return false;
        } else if(price_now > 2000) {
            shibai_alert('扣款金额不能超过2000元!');
            return false;
        }
        return true;
    }

    $('.consultation').click(function () {
        var order_id = '{$detail.order_id}';
        var car_id = '{$detail.car_id}';
        var issue_id = '{$detail.issue_id}';
        if (order_id == '') {
            shibai_alert('缺少必要参数，请联系管理员');
            return;
        }
        var dealer_id = '{$detail.dealer_id}';
        var payprice = $("#deduct_price").val();
        var isValidPrice = validate_deduct_price(payprice);
        if (isValidPrice == false) return;
        var violate_remark = $.trim($('textarea[name=violate_remark]').val());
        if (violate_remark == '') {
            shibai_alert('请填写违约原因');
            return;
        };
        consultation();
        function consultation() {
            var param = {
                'issue_id': issue_id,
                'order_id': order_id,
                'dealer_id': dealer_id,
                'payprice': payprice,
                'car_id': car_id,
                'violate_remark': violate_remark
            };
            $.post('/IssueDealer/doVialate', param, function (data) {
                if (data.code == '200') {
                    btn_alert(data.msg, 2000, function () {
                        window.location.href = document.referrer;
                    });
                } else {
                    shibai_alert(data.msg);
                    return false;
                }
            }, 'json');
        }
    });
    
    // --我方违约补偿金额验证
    function our_validate_price(price_now) {
        if (price_now == '') {
            shibai_alert('金额不能为空!');
            return false;
        }
        if (!/(^[0-9]\d*$)/.test(price_now)) {
            shibai_alert('金额格式不正确!');
            return false;
        }
        return true;
    }

    
    $('.ourviolate').click(function () {
        var order_id = '{$detail.order_id}';
        var car_id = '{$detail.car_id}';
        var issue_id = '{$detail.issue_id}';
        if (order_id == '') {
            shibai_alert('缺少必要参数，请联系管理员');
            return;
        }
        var dealer_id = '{$detail.dealer_id}';
        var compensate_price = $("#compensate_price").val();
        var isValidPrice = our_validate_price(compensate_price);
        if (isValidPrice == false) return;
        var compensate_remark = $.trim($('textarea[name=compensate_remark]').val());
        if (compensate_remark == '') {
            shibai_alert('请填写备注信息');
            return;
        };
        ourviolate();
        function ourviolate() {
            var param = {
                'issue_id': issue_id,
                'order_id': order_id,
                'dealer_id': dealer_id,
                'compensate_price': compensate_price,
                'car_id': car_id,
                'compensate_remark': compensate_remark
            };
            $.post('/IssueDealer/ourVialate', param, function (data) {
                if (data.code == '200') {
                    btn_alert(data.msg, 2000, function () {
                        window.location.href = document.referrer;
                    });
                } else {
                    shibai_alert(data.msg);
                    return false;
                }
            }, 'json');
        }
    });

    
</script>
<include file="Public/foot" />